package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.Attend;
import cn.wolfcode.trip.base.service.IAttendService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 结伴游接口
 */
@RestController
@RequestMapping("attends")
public class AttendController {
    @Autowired
    private IAttendService attendService;
    /**
     * 新增报名
     * @param attend
     * @return
     */
    @PostMapping
    public JSONResult save(Attend attend){
        attendService.save(attend);
        return new JSONResult();
    }

    /**
     * 查询某一 结伴游的报名人员
     * @param id
     * @return
     */
    @GetMapping("{id}")
    public List<Attend> getAttend(@PathVariable Long id){
        List<Attend> list = attendService.selectAttendById(id);
        return list;
    }

}
